home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: why doesn't atof work properly ?
- Date: 3 Feb 1996 17:13 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <3FEB199617132831@erich.triumf.ca>
- References: <4f0ivh$3g7e@yuma.ACNS.ColoState.EDU>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4f0ivh$3g7e@yuma.ACNS.ColoState.EDU>, shuyuan xuan <xuan> writes...
- >I was reading from da.dat, making everything into a char string.
- >Then I used strtok to interpret the string, converting them into int or
- >double variables through atoi or atof. But atof doesn't seem to work
- >at all. Enclosed is the file, da.dat and output.
-
- >#include "stdio.h"
- >#include "strings.h"
- >#include "string.h"
-
- You need to #include either (or both, if you wish) math.h or stdlib.h to get
- the prototype for atof(). Without it, the compiler will assume atof() returns
- an int, with undesireable results.
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
-
-
-